const app = getApp();

Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    callBack: {
      type: String,
      value: ''
    }
  },

  data: {

  },

  methods: {
    bindgetuserinfo(e) {
      if (e.detail.userInfo) {
        app.globalData.isAuthorization = true;
        app.globalData.userInfo = e.detail.userInfo;
        wx.showToast({
          title: '授权成功',
          duration: 1000,
          icon: 'success',
          mask: true,
          success: res => {
            let timer = setTimeout(() => {
              this.triggerEvent('callBack', {
                type: this.data.callBack
              }, {});
              clearTimeout(timer);
            }, 1000);
          }
        });
        this.setData({
          show: false
        });
      };
    },

    hide() {
      this.setData({
        show: false
      });
    }
  }
})